package com.okcoin.websocket.client;

import com.okcoin.common.OKConst;
import com.okcoin.websocket.WebSocketService;

public class StartWebcocket1 {
    public  void startWebcocket1() {

        // 订阅消息处理类,用于处理WebSocket服务返回的消息
        WebSocketService service = new BuissnesWebSocketServiceImpl();

        // WebSocket客户端
        WebSoketClient client = new WebSoketClient(OKConst.WEBSOCKET_ADRESS, service);

        // 启动客户端
        client.start();

        //订阅所有指数
        for(String CA:OKConst.FUTUREUSD_INDEX_LIST){
            client.addChannel(CA);
        }

        //订阅所有合约行情
        for(String CA:OKConst.FUTUREUSD_LIST){
            client.addChannel(CA);
        }

        //订阅所有K线
        for(String CA:OKConst.FUTUREEUSD_K_LINE_LIST){
            client.addChannel(CA);
        }
    }

}
